{include file="common/head"/}
<div class="admin-main layui-anim layui-anim-upbit">
    <form class="layui-form layui-form-pane" lay-filter="form">
        <div class="layui-form-item">
            <label class="layui-form-label">周期名称</label>
            <div class="layui-input-4">
                <input type="text" class="layui-input" name="title" readonly>
            </div>
        </div>

        {if condition="$cycle_data.id == 1"}
        <div class="layui-form-item">
            <label class="layui-form-label">考核时间</label>
            <div class="layui-input-inline">
                <input type="text"  name="start_time"  class="layui-input" id="day_start_time">
            </div>
            <div class="layui-input-inline" style="margin-top: 9px;">
                <span>至</span>
            </div>
            <div class="layui-input-inline" style="margin-top: -1px;margin-left:-174px;">
                <input type="text"  name="end_time"  class="layui-input" id="day_end_time">
            </div>
        </div>

        {elseif condition="$cycle_data.id == 2"/}

        <div class="layui-form-item">
            <label class="layui-form-label" style="padding-left: 0px">考核时间(上)</label>
            <div class="layui-input-inline">
                <input type="text"  name="start_time[]" value="{$cycle_data.start_time.0}"  class="layui-input" id="start_time">
            </div>
            <div class="layui-input-inline" style="margin-top: 9px;">
                <span>至</span>
            </div>
            <div class="layui-input-inline" style="margin-top: -1px;margin-left:-174px;">
                <input type="text"  name="end_time[]"  value="{$cycle_data.end_time.0}" class="layui-input" id="end_time">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label" style="padding-left: 0px">考核时间(下)</label>
            <div class="layui-input-inline">
                <input type="text"  name="start_time[]" value="{$cycle_data.start_time.1}"   class="layui-input" id="start_time1">
            </div>
            <div class="layui-input-inline" style="margin-top: 9px;">
                <span>至</span>
            </div>
            <div class="layui-input-inline" style="margin-top: -1px;margin-left:-174px;">
                <input type="text"  name="end_time[]"  value="{$cycle_data.end_time.1}" class="layui-input" id="end_time1">
            </div>
        </div>

        {else /}

        <div class="layui-form-item">
            <label class="layui-form-label">考核时间</label>
            <div class="layui-input-inline">
                <input type="text"  name="start_time"  class="layui-input" id="start_time">
            </div>
            <div class="layui-input-inline" style="margin-top: 9px;">
                <span>至</span>
            </div>
            <div class="layui-input-inline" style="margin-top: -1px;margin-left:-174px;">
                <input type="text"  name="end_time"  class="layui-input" id="end_time">
            </div>
        </div>


        {/if}

        <div class="layui-form-item">
            <div class="layui-input-block">
                <input type="hidden" name="id" value="{$cycle_data.id}">
                <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button>
            </div>
        </div>
    </form>
</div>
{include file="common/foot"/}
<script>
    layui.use(['form', 'layer','laydate'], function () {
        var form = layui.form,layer = layui.layer,laydate = layui.laydate,$= layui.jquery;

        var info = {$info|raw};
        form.val("form", info);

        laydate.render({
            elem: '#start_time'
            ,type: 'datetime'
            ,format: 'MM-dd' //可任意组合
        });

        laydate.render({
            elem: '#end_time'
            ,type: 'datetime'
            ,format: 'MM-dd' //可任意组合
        });

        laydate.render({
            elem: '#start_time1'
            ,type: 'datetime'
            ,format: 'MM-dd' //可任意组合
        });

        laydate.render({
            elem: '#end_time1'
            ,type: 'datetime'
            ,format: 'MM-dd' //可任意组合
        });

        laydate.render({
            elem: '#day_start_time'
            ,type: 'datetime'
            ,format: 'dd' //可任意组合
        });

        laydate.render({
            elem: '#day_end_time'
            ,type: 'datetime'
            ,format: 'dd' //可任意组合
        });

        form.on('submit(submit)', function (data) {
            // 提交到方法 默认为本身
            $.post("{:url('cycleEdit')}",data.field,function(res){
                if(res.code > 0){
                    layer.msg(res.msg,{time:1000,icon:1},function(){
                        parent.location.href = res.url;
                    });
                }else{
                    layer.msg(res.msg,{time:1000,icon:2});
                }
            });
        })

    });
</script>